package com.xilihui.xlh.business.adapters;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.xilihui.xlh.business.fragments.StoreFragment;

import java.util.ArrayList;

/**
 * Created by Administrator on 2018/5/28.
 */

public class BasePagerAdapter extends FragmentPagerAdapter{

    private ArrayList<String> titles;
    private Context context;
    private getItemFragment itemFragment;

    public BasePagerAdapter(FragmentManager fm,Context context,ArrayList<String> titles) {
        super(fm);
        this.context = context;
        this.titles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return itemFragment.getItem(position);
    }

    @Override
    public int getCount() {
        return titles.size();
    }


    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position);
    }
    
    public void setItemFragment(getItemFragment itemFragment){
        this.itemFragment = itemFragment;
    }
    
    public interface getItemFragment{
        Fragment getItem(int position);
    }
    
}
